﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ccit.Utils;
using System.Collections.Generic;

namespace Ccit.OA.NewsCenter
{
    public class QueryBLL
    {
        #region
        
        /// <summary>
        /// 查询本人的快速查询条件表的信息
        /// </summary>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public List<MsQueryClause> GetFastClauseList(string Type)
        {
            IQuery query = this.GetBllObj();
            LoginUser loginUser = (LoginUser)HttpContext.Current.Session["LogUserInfo"];
            string loginUserId = loginUser.UserId;
            List<MsQueryClause> msclist = query.GetFastClauseList(loginUserId, Type);
            query = null;
            return msclist;
        }
        /// <summary>
        /// delete fast clause
        /// </summary>
        /// <param name="ClauseId"></param>
        /// <returns></returns>
        public List<string> RemoveFastClause(string ClauseId)
        {
            IQuery query = this.GetBllObj();
            List<string> strlist = query.RemoveFastClause(ClauseId);
            query = null;
            return strlist;
        }
        /// <summary>
        /// save fast clause
        /// </summary>
        /// <param name="msc"></param>
        /// <param name="addPlate"></param>
        /// <returns></returns>
        public List<string> SaveFastClause(MsQueryClause msc, string addPlate, string Type, string pageSource)
        {
            IQuery query = this.GetBllObj();
            List<string> strlist = query.SaveFastClause(msc, addPlate, Type, pageSource);
            query = null;
            return strlist;
        }
        /// <summary>
        /// 查询快捷条件对象
        /// </summary>
        /// <param name="clauseId">主键NEWS_A8_10</param>
        /// <returns></returns>
        public MsQueryClause GetClauseObj(string clauseId)
        {
            IQuery query = this.GetBllObj();
            MsQueryClause mqc = query.GetClauseObj(clauseId);
            query = null;
            return mqc;
        }
        #endregion
        private IQuery GetBllObj()
        {
            IQuery query = (IQuery)Factory.CreateObject("Ccit.OA.NewsCenter.dll", "Ccit.OA.NewsCenter.Query", ImportComponentType.DotNetDll, null);
            return query;
        }
    }
}
